package com.bawei.mdm2207alast.model.db

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query

/**
 * 作者：赵亮
 * 时间：2024/12/23 15:31
 * 功能：用户相关的数据访问对象 DAO Data Access Object
 */
@Dao
interface UserDao {

    /**
     * 注册
     */
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun register(userEntity: UserEntity): Long

    /**
     * 登录
     */
    @Query("select * from userentity where name=:name and pass=:pass and role=:role")
    fun login(name: String, pass: String, role: Int): UserEntity
}